<%--
  document: register.jsp
  
  description:
    Registration form.
 --%>

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%-- Importations --%>
<%@page import="javax.el.*" %>
<%@page import="javax.naming.*" %>
<%@page import="javax.faces.context.*" %>
<%@page import="com.reimscopie.*" %>
<%@page import="com.reimscopie.controlers.*" %>
<%@page import="com.reimscopie.beans.interfaces.* "%>
<%@page import="javax.transaction.*" %>

<%-- Tag libs --%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="core"%> 
<%@taglib uri="http://java.sun.com/jsf/html" prefix="html"%> 

<%-- Controlers --%>
<%@include  file="jspf/controlers.jspf" %>

<%-- i18n --%>
<%@include file="jspf/i18n/i18n.jspf" %>

<%
    Context context = new InitialContext() ;
    String name ="com.reimscopie.beans.session.ReimsCopieUserBean_" +
    ReimsCopieUserLocal.class.getName()+"@Local" ;    
    ReimsCopieUserLocal bean = (ReimsCopieUserLocal)context.lookup(name) ;   
    
    String transactionName = "javax.transaction.UserTransaction" ;
    UserTransaction transaction =
            (UserTransaction)context.lookup(transactionName);
    transaction.begin() ;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
          "http://www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
  <%@ include file = "jspf/header.jspf" %>
	</head>
  
  <body>

<core:view>
  
  <div id="page">
  
  <%@include file = "jspf/top.jspf" %>
  
  <div id="middle">
    <div id="menu">
      <div id="search">
        <%@ include file = "jspf/search.jspf" %>
      </div>
      <div id="menu_task">
        <%@ include file = "jspf/home/menu.jspf" %>
      </div>
    </div>
    <div id="contents">
      <div id="onglet">
        <%! String activeTab = "null"; %>
        <%@ include file = "jspf/onglet.jspf" %>
      </div>
      <div id="tree">
          >><a href="register.jsf">
            <%= i18nBundle.getString("register") %>
          </a>
      </div>
      <div id="in">
        <html:form>
            <center>
                <table>
                    <tr>                    
                        <%-- Login --%>
                        <td >
                            
                                <div class="textregister">
                                    <%= i18nBundle.getString("login") %> :
                                </div> 
                            
                        </td>
                        <td>
                            <html:inputText   value="#{RegisterControler.login}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <%-- Mot de passe --%>
                        <td>
                            <div class="textregister">
                                <%= i18nBundle.getString("password") %> :
                            </div>
                        </td>
                        <td>
                            <html:inputSecret value="#{RegisterControler.password}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <%-- Name --%>   
                        <td>
                            <div class="textregister">
                                <%= i18nBundle.getString("name") %> :
                            </div>
                        </td>
                        <td>
                            <html:inputText   value="#{RegisterControler.name}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <%-- Firstname --%>
                        <td>
                            <div class="textregister">
                                <%= i18nBundle.getString("firstname") %> :
                            </div>
                        </td>
                        <td>
                            <html:inputText   value="#{RegisterControler.firstname}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <%-- Mail --%>
                        <td>
                            <div class="textregister">
                                <%= i18nBundle.getString("mail") %> :
                            </div>
                        </td>
                        <td>
                            <html:inputText   value="#{RegisterControler.mail}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <%-- Street --%>
                        <td>
                            <div class="textregister">
                                <%= i18nBundle.getString("street") %> :
                            </div>
                        </td>
                        <td>
                            <html:inputText   value="#{RegisterControler.street}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <%-- Postal Code --%>
                        <td>
                            <div class="textregister">
                                <%= i18nBundle.getString("postalcode") %> :
                            </div>
                        </td>
                        <td>
                            <html:inputText   value="#{RegisterControler.postalCode}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <%-- Town --%>
                        <td>
                            <div class="textregister">
                                <%= i18nBundle.getString("city") %> :
                            </div>
                        </td>
                        <td>
                            <html:inputText   value="#{RegisterControler.city}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <%-- Phone --%>
                        <td>
                            <div class="textregister">
                                <%= i18nBundle.getString("phone") %> :
                            </div>
                        </td>
                        <td>
                            <html:inputText   value="#{RegisterControler.phone}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <%-- Country --%>
                        <td>
                            <div class="textregister">
                                <%= i18nBundle.getString("country") %> :
                            </div>
                        </td>
                        <td>
                            <html:inputText   value="#{RegisterControler.country}" />
                        </td>
                    </tr>
                    
                    <tr>
                        <td colspan = 4>
                            <%-- Newsletter --%>
                            
                            <div class="textregister">
                                <html:selectBooleanCheckbox title="letter"
                                                        value="#{RegisterControler.letter}" />
                                                        
                                <%= i18nBundle.getString("newsletter") %>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan = 4>
                            <center>
                                <html:commandButton value="S'enregistrer" action="#{RegisterControler.register}"/>
                            </center>
                        </td>
                    </tr>
                </table>
            </center>
      </html:form>
  
    </div>
      
    </div>
  </div>
  
  <div id="page_end">
    <%@ include file = "jspf/page-end.jspf" %>
  </div>
  
  <%@ include file = "jspf/footer.jspf" %>
  
</core:view>

<%
    transaction.commit();    
%>